home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Libraries / BlobMgr / Blob Manager Demo 5 / PickWord.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-02-17  |  9.8 KB  |  747 lines  |  [TEXT/MACA]

  1. /*
  2.     Blob ManagerDemo:  Random word picker
  3. */
  4.  
  5.  
  6. # define    maxWords    700
  7.  
  8.  
  9. static char    *word[] =
  10. {
  11. "\paback",
  12. "\pabalone",
  13. "\pabandon",
  14. "\pabase",
  15. "\paccent",
  16. "\paccentuate",
  17. "\paccept",
  18. "\pacerbic",
  19. "\pacrobat",
  20. "\padage",
  21. "\padagio",
  22. "\padamant",
  23. "\padapt",
  24. "\padaptation",
  25. "\paegis",
  26. "\paeolian",
  27. "\paerate",
  28. "\paerial",
  29. "\paerobic",
  30. "\pairborne",
  31. "\paircraft",
  32. "\pallied",
  33. "\palligator",
  34. "\palliterate",
  35. "\pallocate",
  36. "\pambuscade",
  37. "\pambush",
  38. "\pameliorate",
  39. "\pamen",
  40. "\pamend",
  41. "\pangelfish",
  42. "\pangelic",
  43. "\panger",
  44. "\pangiosperm",
  45. "\pangle",
  46. "\pantler",
  47. "\panvil",
  48. "\panxiety",
  49. "\panxious",
  50. "\papproximate",
  51. "\papricot",
  52. "\papron",
  53. "\papropos",
  54. "\papse",
  55. "\parrangeable",
  56. "\parray",
  57. "\parrear",
  58. "\parrest",
  59. "\parrival",
  60. "\passignation",
  61. "\passignee",
  62. "\passimilate",
  63. "\passist",
  64. "\paudible",
  65. "\paudience",
  66. "\paudio",
  67. "\paudiotape",
  68. "\paudiovisual",
  69. "\paxiomatic",
  70. "\paxis",
  71. "\paxisymmetric",
  72. "\paxle",
  73. "\paxon",
  74. "\pbamboo",
  75. "\pbanal",
  76. "\pbanana",
  77. "\pband",
  78. "\pbasilar",
  79. "\pbasilisk",
  80. "\pbasin",
  81. "\pbasis",
  82. "\pbask",
  83. "\pbedroom",
  84. "\pbedside",
  85. "\pbedspread",
  86. "\pbedspring",
  87. "\pbedstraw",
  88. "\pbenevolent",
  89. "\pbenight",
  90. "\pbenign",
  91. "\pbent",
  92. "\pbenthic",
  93. "\pbifocal",
  94. "\pbifurcate",
  95. "\pbigotry",
  96. "\pbivalve",
  97. "\pbivouac",
  98. "\pbizarre",
  99. "\pbluebill",
  100. "\pbluebird",
  101. "\pbluebonnet",
  102. "\pbluebook",
  103. "\pbluebush",
  104. "\pbookish",
  105. "\pbookkeep",
  106. "\pbooklet",
  107. "\pbookplate",
  108. "\pbookseller",
  109. "\pbrae",
  110. "\pbrag",
  111. "\pbragging",
  112. "\pbraid",
  113. "\pbrain",
  114. "\pbring",
  115. "\pbrink",
  116. "\pbriny",
  117. "\pbrisk",
  118. "\pbugle",
  119. "\pbuild",
  120. "\pbuildup",
  121. "\pbuilt",
  122. "\pbuiltin",
  123. "\pbutene",
  124. "\pbutler",
  125. "\pbutte",
  126. "\pcaliph",
  127. "\pcalisthenic",
  128. "\pcall",
  129. "\pcalumny",
  130. "\pcalypso",
  131. "\pcamera",
  132. "\pcamouflage",
  133. "\pcandlestick",
  134. "\pcapacitive",
  135. "\pcapacity",
  136. "\pcape",
  137. "\pcapella",
  138. "\pcartwheel",
  139. "\pcarve",
  140. "\pcascade",
  141. "\pcedilla",
  142. "\pceil",
  143. "\pcelandine",
  144. "\pcelebrant",
  145. "\pcelebrate",
  146. "\pchangeable",
  147. "\pchangeover",
  148. "\pchannel",
  149. "\pchant",
  150. "\pchicory",
  151. "\pchide",
  152. "\pchief",
  153. "\pchiefdom",
  154. "\pchieftain",
  155. "\pclassmate",
  156. "\pclassroom",
  157. "\pclassy",
  158. "\pclatter",
  159. "\pclattery",
  160. "\pcoachwork",
  161. "\pcoadjutor",
  162. "\pcoagulable",
  163. "\pcola",
  164. "\pcolander",
  165. "\pcolatitude",
  166. "\pcold",
  167. "\pcoleus",
  168. "\pcommit",
  169. "\pcommittable",
  170. "\pconceal",
  171. "\pconcede",
  172. "\pconceit",
  173. "\pconceive",
  174. "\pconcentrate",
  175. "\pcongener",
  176. "\pcongenital",
  177. "\pcongest",
  178. "\pcongestion",
  179. "\pcontaminant",
  180. "\pcontemplate",
  181. "\pcontemporary",
  182. "\pcontempt",
  183. "\pcool",
  184. "\pcoolant",
  185. "\pcoolheaded",
  186. "\pcoon",
  187. "\pcoop",
  188. "\pcosine",
  189. "\pcosmetic",
  190. "\pcosmic",
  191. "\pcosmology",
  192. "\pcowlick",
  193. "\pcoworker",
  194. "\pcowpea",
  195. "\pcrevice",
  196. "\pcrew",
  197. "\pcrewcut",
  198. "\pcrewel",
  199. "\pcrewman",
  200. "\pcubbyhole",
  201. "\pcube",
  202. "\pcubic",
  203. "\pcybernetics",
  204. "\pcycle",
  205. "\pcyclic",
  206. "\pcyclist",
  207. "\pdeadwood",
  208. "\pdeaf",
  209. "\pdeafen",
  210. "\pdeal",
  211. "\pdeallocate",
  212. "\pdeduce",
  213. "\pdeducible",
  214. "\pdeduct",
  215. "\pdeductible",
  216. "\pdeed",
  217. "\pdelusive",
  218. "\pdeluxe",
  219. "\pdelve",
  220. "\pdemagnify",
  221. "\pdemagogue",
  222. "\pdepute",
  223. "\pdeputy",
  224. "\pderail",
  225. "\pderange",
  226. "\pderate",
  227. "\pdeviate",
  228. "\pdevice",
  229. "\pdevil",
  230. "\pdevilish",
  231. "\pdevious",
  232. "\pdiffusive",
  233. "\pdifluoride",
  234. "\pdigest",
  235. "\pdigestible",
  236. "\pdisembowel",
  237. "\pdisgruntle",
  238. "\pdisgustful",
  239. "\pdish",
  240. "\pdishevel",
  241. "\pdockyard",
  242. "\pdoctor",
  243. "\pdoctoral",
  244. "\pdoctorate",
  245. "\pdoctrinaire",
  246. "\pdowitcher",
  247. "\pdown",
  248. "\pdowncast",
  249. "\pdowndraft",
  250. "\pdrought",
  251. "\pdrove",
  252. "\pdrown",
  253. "\pdrowse",
  254. "\pdrowsy",
  255. "\pdyspeptic",
  256. "\pdysplasia",
  257. "\pdysprosium",
  258. "\pdystrophy",
  259. "\peffluent",
  260. "\peffort",
  261. "\peffusive",
  262. "\pelution",
  263. "\pelves",
  264. "\pelysian",
  265. "\pemaciate",
  266. "\pencompass",
  267. "\pencore",
  268. "\pencounter",
  269. "\pencourage",
  270. "\pencroach",
  271. "\pentrap",
  272. "\pentrapping",
  273. "\pentreat",
  274. "\pentreaty",
  275. "\pentree",
  276. "\pergodic",
  277. "\perode",
  278. "\perodible",
  279. "\perosible",
  280. "\perosion",
  281. "\pevaporate",
  282. "\pevasion",
  283. "\pevasive",
  284. "\peven",
  285. "\pexempt",
  286. "\pexemption",
  287. "\pexercisable",
  288. "\pexercise",
  289. "\pexert",
  290. "\pexpressway",
  291. "\pexpropriate",
  292. "\pexpulsion",
  293. "\pexpunge",
  294. "\pexpurgate",
  295. "\pfair",
  296. "\pfairgoer",
  297. "\pfairway",
  298. "\pfairy",
  299. "\pfaith",
  300. "\pfederal",
  301. "\pfibula",
  302. "\pfiesta",
  303. "\pfife",
  304. "\pfifteen",
  305. "\pfifth",
  306. "\pfixate",
  307. "\pfixture",
  308. "\pfloor",
  309. "\pfloorboard",
  310. "\pfloppy",
  311. "\pfoolproof",
  312. "\pfootball",
  313. "\pfootbridge",
  314. "\pfootfall",
  315. "\pfoothill",
  316. "\pfootman",
  317. "\pfountain",
  318. "\pfountainhead",
  319. "\pfour",
  320. "\pfourfold",
  321. "\pfoursome",
  322. "\pfritillary",
  323. "\pfritter",
  324. "\pfrivolity",
  325. "\pgabardine",
  326. "\pgastronomy",
  327. "\pgate",
  328. "\pgesticulate",
  329. "\pgesture",
  330. "\pgetaway",
  331. "\pgetting",
  332. "\pgloat",
  333. "\pglob",
  334. "\pglobal",
  335. "\pgorilla",
  336. "\pgoshawk",
  337. "\pgreater",
  338. "\pgrebe",
  339. "\pgreed",
  340. "\pgreedy",
  341. "\pgreen",
  342. "\pguidance",
  343. "\pguide",
  344. "\pguidebook",
  345. "\pguideline",
  346. "\pguidepost",
  347. "\phailstorm",
  348. "\phair",
  349. "\phaircut",
  350. "\phairdo",
  351. "\phairpin",
  352. "\pharem",
  353. "\phark",
  354. "\pharm",
  355. "\pharmful",
  356. "\pharmonic",
  357. "\pheave",
  358. "\pheaven",
  359. "\pheavenward",
  360. "\pheavy",
  361. "\pheavyweight",
  362. "\phero",
  363. "\pheroic",
  364. "\phistorian",
  365. "\phistory",
  366. "\phood",
  367. "\phoodlum",
  368. "\phoofmark",
  369. "\phook",
  370. "\phubby",
  371. "\phymnal",
  372. "\phyperbola",
  373. "\pillustrious",
  374. "\pimage",
  375. "\pimaginary",
  376. "\pimposition",
  377. "\pimpossible",
  378. "\pimposture",
  379. "\pimpotent",
  380. "\pinclude",
  381. "\pincoherent",
  382. "\pincome",
  383. "\pineducable",
  384. "\pineffable",
  385. "\pineffective",
  386. "\pineffectual",
  387. "\pinfringe",
  388. "\pinfuriate",
  389. "\pinfuse",
  390. "\pinsightful",
  391. "\pinsignia",
  392. "\pinsincere",
  393. "\pinsinuate",
  394. "\pinsipid",
  395. "\pinterstitial",
  396. "\pinterval",
  397. "\pionosphere",
  398. "\piota",
  399. "\pjalopy",
  400. "\pjamboree",
  401. "\pjudge",
  402. "\pjudicature",
  403. "\pjudicial",
  404. "\pkeyword",
  405. "\pkhaki",
  406. "\pkibbutzim",
  407. "\plark",
  408. "\plarkspur",
  409. "\plarva",
  410. "\pleatherwork",
  411. "\pleave",
  412. "\pleaven",
  413. "\pliberal",
  414. "\pliberate",
  415. "\pliberty",
  416. "\pliquidate",
  417. "\plist",
  418. "\plonesome",
  419. "\plong",
  420. "\plongevity",
  421. "\plonghand",
  422. "\plonghorn",
  423. "\plunar",
  424. "\plunatic",
  425. "\plunch",
  426. "\pmaidservant",
  427. "\pmail",
  428. "\pmailbox",
  429. "\pmalice",
  430. "\pmansion",
  431. "\pmastiff",
  432. "\pmastodon",
  433. "\pmatch",
  434. "\pmatchbook",
  435. "\pmegalomaniac",
  436. "\pmetalwork",
  437. "\pmetamorphic",
  438. "\pmetaphor",
  439. "\pmillennium",
  440. "\pmiller",
  441. "\pmillet",
  442. "\pmoan",
  443. "\pmoat",
  444. "\pmonth",
  445. "\pmonument",
  446. "\pmood",
  447. "\pmuffin",
  448. "\pmuffle",
  449. "\pmyocardium",
  450. "\pmyopia",
  451. "\pneedful",
  452. "\pneedle",
  453. "\pneedlepoint",
  454. "\pnightmare",
  455. "\pnightshirt",
  456. "\pnighttime",
  457. "\pnihilism",
  458. "\pnoteworthy",
  459. "\pnothing",
  460. "\pnotice",
  461. "\pnoticeable",
  462. "\pnotify",
  463. "\pobjector",
  464. "\pobligatory",
  465. "\poblige",
  466. "\pofficious",
  467. "\poffset",
  468. "\popposition",
  469. "\poppress",
  470. "\postentatious",
  471. "\posteology",
  472. "\ppalette",
  473. "\ppalindrome",
  474. "\ppalisade",
  475. "\pparaxial",
  476. "\pparboil",
  477. "\pparcel",
  478. "\pparch",
  479. "\ppardon",
  480. "\ppathology",
  481. "\ppathway",
  482. "\ppatient",
  483. "\ppellagra",
  484. "\ppellet",
  485. "\ppelt",
  486. "\ppelvic",
  487. "\pperiwinkle",
  488. "\pperjure",
  489. "\pperjury",
  490. "\pperk",
  491. "\pphantom",
  492. "\ppharmacist",
  493. "\ppiety",
  494. "\ppigeon",
  495. "\pplacebo",
  496. "\pplaceholder",
  497. "\pplacenta",
  498. "\pplowshare",
  499. "\ppluck",
  500. "\pplug",
  501. "\ppolymorphic",
  502. "\ppolynomial",
  503. "\ppolyphony",
  504. "\ppolytechnic",
  505. "\ppostman",
  506. "\ppostmark",
  507. "\ppostmortem",
  508. "\ppreen",
  509. "\pprefabricate",
  510. "\ppreface",
  511. "\pprincess",
  512. "\pprinciple",
  513. "\pprint",
  514. "\pprompt",
  515. "\ppromulgate",
  516. "\pprone",
  517. "\pprong",
  518. "\pprovidential",
  519. "\pprovince",
  520. "\pprovision",
  521. "\ppunt",
  522. "\ppuny",
  523. "\ppupal",
  524. "\pquantum",
  525. "\pquarantine",
  526. "\pquark",
  527. "\pquarrel",
  528. "\pquiet",
  529. "\pradio",
  530. "\pradioactive",
  531. "\pradiocarbon",
  532. "\praucous",
  533. "\pravel",
  534. "\praven",
  535. "\predactor",
  536. "\predcoat",
  537. "\predden",
  538. "\preliant",
  539. "\prelic",
  540. "\prelieve",
  541. "\prescind",
  542. "\prescue",
  543. "\presemble",
  544. "\present",
  545. "\pretrovision",
  546. "\preturn",
  547. "\preveal",
  548. "\prevelation",
  549. "\prightward",
  550. "\prigid",
  551. "\prigorous",
  552. "\prill",
  553. "\prose",
  554. "\prosebud",
  555. "\prosebush",
  556. "\prosette",
  557. "\prusset",
  558. "\prust",
  559. "\prustic",
  560. "\prustle",
  561. "\psalvo",
  562. "\psame",
  563. "\psaxophone",
  564. "\pscabbard",
  565. "\pscout",
  566. "\pscowl",
  567. "\pscraggly",
  568. "\pscram",
  569. "\psecrecy",
  570. "\psecret",
  571. "\psecretarial",
  572. "\pseparate",
  573. "\pshaky",
  574. "\pshale",
  575. "\pshallot",
  576. "\pshoemaker",
  577. "\pshoestring",
  578. "\pshone",
  579. "\psideboard",
  580. "\psidecar",
  581. "\psidelight",
  582. "\psideline",
  583. "\psingsong",
  584. "\psingular",
  585. "\psinistral",
  586. "\pslander",
  587. "\pslang",
  588. "\pslant",
  589. "\pslap",
  590. "\psmile",
  591. "\psmirk",
  592. "\psmithereens",
  593. "\psmithy",
  594. "\psocial",
  595. "\psociety",
  596. "\psophistry",
  597. "\psophomore",
  598. "\psoprano",
  599. "\pspecify",
  600. "\pspecimen",
  601. "\pspecious",
  602. "\pspeckle",
  603. "\pspokesmen",
  604. "\psponge",
  605. "\psponsor",
  606. "\pspontaneity",
  607. "\pstable",
  608. "\pstableman",
  609. "\pstaccato",
  610. "\pstealthy",
  611. "\psteam",
  612. "\psteamboat",
  613. "\psteed",
  614. "\pstonewall",
  615. "\pstoneware",
  616. "\pstonewort",
  617. "\pstony",
  618. "\pstrontium",
  619. "\pstrophe",
  620. "\pstrove",
  621. "\psuccumb",
  622. "\psuch",
  623. "\psuckling",
  624. "\psuperstition",
  625. "\psupervene",
  626. "\psupervisory",
  627. "\psupine",
  628. "\psweepstake",
  629. "\psweetheart",
  630. "\pswell",
  631. "\psystematic",
  632. "\psystemic",
  633. "\ptapping",
  634. "\ptarantula",
  635. "\pteleost",
  636. "\ptelepathic",
  637. "\ptelephone",
  638. "\ptestimony",
  639. "\ptesty",
  640. "\pthieves",
  641. "\pthigh",
  642. "\pthimble",
  643. "\pthreadbare",
  644. "\ptiara",
  645. "\ptibia",
  646. "\ptick",
  647. "\pticket",
  648. "\ptickle",
  649. "\ptolerant",
  650. "\ptoll",
  651. "\ptollhouse",
  652. "\ptownhouse",
  653. "\ptownsman",
  654. "\ptoxic",
  655. "\ptoxicology",
  656. "\ptrap",
  657. "\ptrapezium",
  658. "\ptrapezoid",
  659. "\ptrip",
  660. "\ptripartite",
  661. "\ptripe",
  662. "\ptriple",
  663. "\ptriplet",
  664. "\ptumultuous",
  665. "\ptuna",
  666. "\ptundra",
  667. "\ptune",
  668. "\ptyranny",
  669. "\pupshot",
  670. "\pupstair",
  671. "\pvanguard",
  672. "\pvanilla",
  673. "\pvanish",
  674. "\pvanity",
  675. "\pvanquish",
  676. "\pvertical",
  677. "\pvertices",
  678. "\pvertigo",
  679. "\pvery",
  680. "\pvirtue",
  681. "\pviscount",
  682. "\pviscous",
  683. "\pvise",
  684. "\pvisible",
  685. "\pwail",
  686. "\pwaist",
  687. "\pwaistcoat",
  688. "\pwaistline",
  689. "\pwaterproof",
  690. "\pwatershed",
  691. "\pwaterway",
  692. "\pwatery",
  693. "\pwheat",
  694. "\pwheedle",
  695. "\pwheel",
  696. "\pwheelbase",
  697. "\pwield",
  698. "\pwiener",
  699. "\pwife",
  700. "\pwindbag",
  701. "\pwoebegone",
  702. "\pwoke",
  703. "\pwring",
  704. "\pwrinkle",
  705. "\pwrist",
  706. "\pyule",
  707. "\pzero",
  708. "\pzinc",
  709. "\pzucchini",
  710. "\pzygodactyl"
  711. };
  712.  
  713. static int    wOrder[maxWords];
  714. static int    wIndex = maxWords;
  715.  
  716.  
  717. char *PickWord ()
  718. {
  719. int        i, j, n;
  720.  
  721.     if (wIndex >= maxWords)
  722.     {
  723. /*
  724.     Initialize the array with the values 0 .. maxWords-1.
  725.     Randomize it by walking through it one element at a time,
  726.     swapping the contents of each element with a randomly chosen
  727.     other element.  This pretty much ensures that each element
  728.     is swapped at least once (though not necessarily), and takes
  729.     time linearly related to the length of the array.
  730. */
  731.  
  732.         for (i = 0; i < maxWords; ++i)
  733.             wOrder[i] = i;
  734.         for (i = 0; i < maxWords; ++i)
  735.         {
  736.             j = BlobRand (maxWords - 1);
  737.             n = wOrder[i];
  738.             wOrder[i] = wOrder[j];
  739.             wOrder[j] = n;
  740.         }
  741.  
  742.         wIndex = 0;
  743.     }
  744.  
  745.     return (word[wOrder[wIndex++]]);
  746. }
  747.